package cool.mtc.base.plugin.generator.code.model.template.bg;

import cool.mtc.core.util.StringUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

/**
 * @author 明河
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BgDaoXmlTemplateParam extends BgDaoTemplateParam {

    public BgDaoXmlTemplateParam(BgDaoTemplateParam daoTemplateParam) {
        BeanUtils.copyProperties(daoTemplateParam, this);
    }

    public String getExtensionName() {
        return ".xml";
    }

    @Override
    public String getTemplateRelativePath() {
        return "bg/dao_xml.ftl";
    }

    @Override
    public String getTargetFilePath() {
        return this.fixPath(this.getProjectPath()) +
                "src/main/resources/mapper/" +
                this.fixPath(this.getRelativePackage().replace(StringUtil.POINT, StringUtil.SLASH)) +
                this.getClassName() +
                this.getExtensionName();
    }
}
